# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=libkcddb
pkgver=22.04.3
pkgrel=0
# armhf blocked by extra-cmake-modules
# s390x and riscv64 blocked by polkit -> kio
arch="all !armhf !s390x !riscv64"
url="https://www.kde.org/applications/multimedia/"
pkgdesc="KDE CDDB library"
license="LGPL-2.0-or-later AND GPL-2.0-or-later"
makedepends="
	extra-cmake-modules
	kcodecs-dev
	kconfig-dev
	kdoctools-dev
	ki18n-dev
	kio-dev
	kwidgetsaddons-dev
	libmusicbrainz-dev
	qt5-qtbase-dev
	samurai
	"
source="https://download.kde.org/stable/release-service/$pkgver/src/libkcddb-$pkgver.tar.xz"
subpackages="$pkgname-dev $pkgname-doc $pkgname-lang"
options="net" # Required for tests

build() {
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=RelWithDebInfo \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_TESTING=ON
	cmake --build build
}

check() {
	cd build
	# musicbrainztest-severaldiscs, asynccddblookuptest and synccddblookuptest are broken
	# asynchttplookuptest fails to setup dbus
	CTEST_OUTPUT_ON_FAILURE=TRUE ctest -E "(musicbrainztest-severaldiscs|asynchttplookuptest|asynccddblookuptest|synccddblookuptest)"
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
4bd1e4f39ef8adb7957e9f186be55685b176057e3f80cd244586d5a65ddd507df8c6cd417ff98d9a6c898ff8604731641647e5a739d76b2049d031b91ba62fb6  libkcddb-22.04.3.tar.xz
"
